var t = getApp();

Page({
    data: {
        custom_title: "",
        custom_value: ""
    },
    onLoad: function(t) {
        this._getMemberInfo2();
    },
    onReady: function() {},
    onShow: function() {},
    onHide: function() {},
    onUnload: function() {},
    onPullDownRefresh: function() {},
    onReachBottom: function() {},
    onShareAppMessage: function() {},
    custom_inp: function(t) {
        var e = t.detail.value;
        this.setData({
            custom_value: e.trim()
        });
    },
    _getMemberInfo2: function() {
        var e = this, o = t.getNetAddresss("member.member.get-custom-field");
        t._getNetWork({
            url: o,
            success: function(t) {
                var o = t.data;
                1 == o.result && e.setData({
                    custom_title: o.data.custom_title
                });
            },
            fail: function(t) {
                console.log(t);
            }
        });
    },
    submitInfo: function() {
        if (t._isTextEmpty(this.data.custom_value)) wx.showToast({
            icon: "none",
            title: this.data.custom_title + "信息不能为空",
            duration: 1500
        }); else {
            var e = t.getNetAddresss("member.member.save-custom-field");
            e += "&custom_value=" + this.data.custom_value, t._getNetWork({
                url: e,
                success: function(t) {
                    var e = t.data;
                    1 == e.result ? wx.showToast({
                        title: "成功",
                        icon: "none",
                        duration: 1500,
                        success: function() {
                            setTimeout(function() {
                                wx.navigateBack({
                                    delta: 1
                                });
                            }, 1500);
                        }
                    }) : wx.showToast({
                        title: e.msg,
                        icon: "none",
                        duration: 1500,
                        success: function() {
                            setTimeout(function() {
                                wx.navigateBack({
                                    delta: 1
                                });
                            }, 1500);
                        }
                    });
                },
                fail: function(t) {
                    console.log(t);
                }
            });
        }
    }
});